The Problem
Data files can come in lots of shapes, sizes, and formats. This is especially the case when working with numbers, as there are lots of ways to format a negative. Traditionally, in Excel, this is done by using a ‘-’, red text colour, and sometimes within brackets.
For example, we will work with the following data set:
You’ll notice that the values with a negative profit have been inputted with brackets around them. This may be great for accountants… but causes problems in Tableau as they aren’t recognised as negatives (or even numbers!) resulting in the following:
There are two problems after the import…
1, Profit column has a data type of ‘string’
2, Negative values have brackets around them
The Solution?
Now, this is really easy… all you need to do is change the data type to ‘Number (Decimal)’ and there you have it!
Tableau automatically identifies the bracketed numbers and converts them to negatives.
Pretty neat and a great time saver!